home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / tsbat36.zip / FU.BAT < prev    next >
DOS Batch File  |  1991-07-10  |  2KB  |  65 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────┐
  4. echo │ Poor man's FUnction evaluator utilizing gwbasic   │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, 10-Jul-91 │
  6. echo └───────────────────────────────────────────────────┘
  7. echo.
  8.  
  9. if "%1"=="" goto _help
  10. if not "%2"=="" goto _err1
  11.  
  12. rem Check if (ram)disk r: exists, if not use the current directory
  13. if exist r:\nul set _file=r:\tmp.bas
  14. if not exist r:\nul set _file=tmp.bas
  15.  
  16. rem Check that gwbasic.exe is available at path
  17. set _found=no
  18. if exist gwbasic.exe set _found=yes
  19. for %%d in (%path%) do if exist %%d\gwbasic.exe set _found=yes
  20. if "%_found%"=="no" goto _err2
  21.  
  22. rem Make an appropriate basic program and call it
  23. echo 10 on error goto 50 > %_file%
  24. echo 20 let y=%1 >> %_file%
  25. echo 30 print "%1 = ";%1 >> %_file%
  26. echo 40 system >> %_file%
  27. echo 50 print "Error in your expression %1" >> %_file%
  28. echo 60 system >> %_file%
  29. gwbasic %_file%
  30. if exist %_file% del %_file% > nul
  31. goto _out
  32.  
  33. :_err1
  34. echo No spaces are allowed in the expression
  35. goto _out
  36.  
  37. :_err2
  38. echo You must have gwbasic.exe at your path (or the current directory)
  39. goto _out
  40.  
  41. :_help
  42. echo Usage: FU [ExpressionToBeEvaluated]
  43. echo.
  44. echo Examples: FU 4/7      (FU 4D/7D for double precision)
  45. echo.
  46. echo To use this batch you need gwbasic.exe, which comes with MsDos,
  47. echo at your path (it usually already is there).
  48. echo.
  49. echo If you get an "Out of environment space" message, increase your
  50. echo environment space by using shell configuration in config.sys:
  51. echo MsDos 3.30 example: shell=c:\bin\command.com /e:1024 /p
  52. echo.
  53. echo The basic idea (pardon the pun) of combining batch and gwbasic
  54. echo programming is not really mine. I got it from the PC-Magazine.
  55. echo The code of this batch, however, is entirely due to yours truly.
  56. echo.
  57. echo And here cometh the "commercial". For a fully-fledged function
  58. echo evaluator and plotter get tsfunc13.arc (or whatever version
  59. echo number is the latest) e.g. from garbo.uwasa.fi archives.
  60.  
  61. :_out
  62. set _file=
  63. set _found=
  64. echo on
  65.